import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { Language } from "../../../../extend/language/Language";
import { GBox } from "../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../com/mui/containers/globalVariable/GBoxDirection";
import { GScrollPane } from "../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { ObjectPool } from "../../../../com/gengine/utils/pools/ObjectPool";
import { CanGetTaskItem } from "./CanGetTaskItem";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class CanGetTaskList
    
    export  class CanGetTaskList /* flash.display.Sprite */
    {
        constructor(arg1: int, arg2: int)
        {
            
            this._width = arg1;
            this._height = arg2;
            this.initUI();
            mouseEnabled = false;
            return;
        }

        /* internal  */initUI(): void
        {
            this._line = GlobalClass.getScaleBitmap(ImagesConst.SplitLine);
            this._line.width = this._width;
            addChild(this._line);
            this._line2 = GlobalClass.getScaleBitmap(ImagesConst.SplitLine);
            this._line2.width = this._width;
            this._line2.y = 30;
            addChild(this._line2);
            this._taskName = new Object /* flash.text.TextField */();
            this._taskName.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._taskName.selectable = false;
            this._taskName.textColor = 16636418;
            this._taskName.filters = [FilterConst.nameGlowFilter];
            this._taskName.text = Language.getString(20651);
            this._taskName.x = 20;
            this._taskName.y = 7;
            addChild(this._taskName);
            this._taskExp = new Object /* flash.text.TextField */();
            this._taskExp.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._taskExp.selectable = false;
            this._taskExp.textColor = 16636418;
            this._taskExp.filters = [FilterConst.nameGlowFilter];
            this._taskExp.text = Language.getString(20652);
            this._taskExp.x = 155;
            this._taskExp.y = this._taskName.y;
            addChild(this._taskExp);
            this._taskItem = new Object /* flash.text.TextField */();
            this._taskItem.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._taskItem.selectable = false;
            this._taskItem.textColor = 16636418;
            this._taskItem.filters = [FilterConst.nameGlowFilter];
            this._taskItem.text = Language.getString(20653);
            this._taskItem.x = 260;
            this._taskItem.y = this._taskName.y;
            addChild(this._taskItem);
            this._taskOpt = new Object /* flash.text.TextField */();
            this._taskOpt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._taskOpt.selectable = false;
            this._taskOpt.textColor = 16636418;
            this._taskOpt.filters = [FilterConst.nameGlowFilter];
            this._taskOpt.text = Language.getString(20654);
            this._taskOpt.x = 370;
            this._taskOpt.y = this._taskName.y;
            addChild(this._taskOpt);
            this._bodySprite = new GBox();
            this._bodySprite.direction = GBoxDirection.VERTICAL;
            this._scrollPane = new GScrollPane();
            this._scrollPane.width = this._width;
            this._scrollPane.height = this._height - 2;
            this._scrollPane.x = 0;
            this._scrollPane.y = 32;
            this._scrollPane.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._scrollPane.verticalScrollPolicy = ScrollPolicy.OFF;
            this._scrollPane.scrollDrag = false;
            this._scrollPane.focusEnabled = false;
            this._scrollPane.styleName = "GScrollPane";
            this._scrollPane.source = this._bodySprite;
            addChild(this._scrollPane);
            return;
        }

        public updateData(arg1: Array<any>, arg2: Boolean): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            this.dispose();
            var loc4=arg1.length;
            while (loc3 < loc4) 
            {
                if ((loc2 = arg1[loc3]) != null) 
                {
                    loc1 = ObjectPool.getObject(CanGetTaskItem);
                    loc1.updateData(loc2, arg2);
                    this._bodySprite.addChild(loc1);
                }
                ++loc3;
            }
            this._bodySprite.invalidate();
            this._scrollPane.update();
            this._scrollPane.refreshPane();
            return;
        }

        public dispose(): void
        {
            var loc1=null;
            while (this._bodySprite.numChildren > 0) 
            {
                loc1 = this._bodySprite.removeChildAt(0) as CanGetTaskItem;
                loc1.dispose();
                ObjectPool.disposeObject(loc1, CanGetTaskItem);
            }
            return;
        }

        public /* override */ get width(): number
        {
            return this._width;
        }

        public /* override */ get height(): number
        {
            return this._height;
        }

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_height: int;

        /* internal */ /* var */_line: ScaleBitmap;

        /* internal */ /* var */_line2: ScaleBitmap;

        /* internal */ /* var */_taskName: Object /* flash.text.TextField */;

        /* internal */ /* var */_taskExp: Object /* flash.text.TextField */;

        /* internal */ /* var */_taskItem: Object /* flash.text.TextField */;

        /* internal */ /* var */_taskOpt: Object /* flash.text.TextField */;

        /* internal */ /* var */_scrollPane: GScrollPane;

        /* internal */ /* var */_bodySprite: GBox;
    }
